<script setup lang="ts">
import AppRegionTree from './components/app-region-tree.vue';
interface Props {
  modelValue: boolean;
}
const props = withDefaults(defineProps<Props>(), {
  modelValue: false,
});

interface Emits {
  (e: 'update:modelValue'): void;
  (e: 'onSelected', regionId: string, regionName: string): void;
}

const emits = defineEmits<Emits>();
</script>
<template>
  <nut-popup
    round
    position="bottom"
    :visible="props.modelValue"
    @click-overlay="emits('update:modelValue')"
  >
    <app-region-tree
      @on-selected="(regionId: string, regionName: string) => {
        emits('onSelected', regionId, regionName);
        emits('update:modelValue')
    }"
    />
  </nut-popup>
</template>
